-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handle open handles from inside tests #6263
Conversation
packages/jest-cli/src/cli/index.js
Outdated
|
||
const stacks = new Set(); | ||
|
||
const uniqueErrors = formatted.filter(handle => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any difference about Timeout
and TIMERWRAP
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK. TIMEWRAP
is a libuv thing, that's what I got from googling it. I don't think it really matters, they point to the same thing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or maybe we can just ditch the filtering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer wanted to filter out the dupe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just add a comment about the dupes? Should be good enough
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -39,7 +39,7 @@ function promisifyLifeCycleFunction(originalFn, env) { | |||
|
|||
// We make *all* functions async and run `done` right away if they | |||
// didn't return a promise. | |||
const asyncFn = function(done) { | |||
const asyncJestLifecycle = function(done) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seemed easiest 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Some weird errors happening on Node 10 |
Yeah, node 10.2.0 is messed up. nodejs/node#20921 |
3d28fb1
to
24606f3
Compare
I need to fix this for circus |
a92dae2
to
fed0667
Compare
@aaronabramov I added a second commit attempting to fix this for circus, but I still get some jest internals I don't care about. Current results is this: Ideas on how to detect just stuff created in user code, and avoid the recursive calls circus itself does? |
d419c93
to
f65ed9e
Compare
if (error.stack.includes('Runtime.requireModule')) { | ||
if ( | ||
error.stack.includes('Runtime.requireModule') || | ||
(error.stack.includes('callAsyncCircusFn') && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this be || instead of &&?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a new commit extracting this into a function where I think the logic (that doesn't really work...) is easier to follow
wouldn't this always be triggered from somewhere in user's code though? |
packages/jest-cli/src/cli/index.js
Outdated
|
||
// E.g. timeouts might give multiple traces to the same line of code | ||
// This hairy filtering tries to remove entries with duplicate stack traces | ||
const uniqueErrors = formatted.filter(handle => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we exatract this into a separate module?
i a little worried about introducing so much complex logic right in index.js
:P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I can extract it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done now
Basically, we track absolutely everything async happening in the process. But a lot of async stuff is expected such as triggering |
@SimenB can we attach an extra flag to it when we trigger them? |
7eadb3d
to
7756068
Compare
Good point, that might actually solve my issue. That's awesome. I'll rebase after it lands 🙂 |
7756068
to
860e923
Compare
Rebased, and looks good locally |
Hmm, for some reason this timeout is reported on CI, but not locally: https://github.com/facebook/jest/blob/c0819fc0c39dc3e7bc20513963678894e5bae6ab/packages/jest-circus/src/utils.js#L175-L178 |
|
Green! 🎉 |
This reverts commit 176a9c1.
🎉 |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
@thymikee found this one before the tweet storm yesterday 😅
Test plan
Added test